package com.service.luo;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.dao.luo.WordselDao;
import com.entity.Wordsel;

@Service
@Transactional(rollbackFor=Exception.class)
public class WordselService {
	@Autowired
	private WordselDao wordselDao;
	
	public void updateWordsels(ArrayList<Wordsel> wordsels) {
		for(Wordsel wordselP:wordsels) {
			Wordsel wordsel=wordselDao.findOne(wordselP.getSelvalno());
			wordsel.setSelvalname(wordselP.getSelvalname());
			wordsel.setIsdefault(wordselP.getIsdefault());
			wordsel.setWselisuse(wordselP.getWselisuse());
		}
	}
	
	public List<Wordsel> findWordselByWordno(Long wordno){
		return wordselDao.getWordselsByWordno(wordno);
	}
}
